Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Completion Functions

Compressor components call completion functions when they have finished an asynchronous operation. The component supplies a result code to your completion function. This result code indicates the success or failure of the asynchronous operation. Note that any other result data that may be produced by the asynchronous operation is not valid until the component calls your completion function.

The CompletionProcPtr data type defines a pointer to a completion function. You assign a completion function to an image or a sequence by passing a pointer to a structure that identifies the function to the appropriate function.

typedef struct CompletionProcRecord CompletionProcRecord;

The completion function structure contains the following fields:

typedef ICMCompletionProcRecord *ICMCompletionProcRecordPtr;
struct ICMCompletionProcRecord
{
    ICMCompletionUPP        completionProc;                                 
                                        /* pointer to completion function */
    long                    completionRefCon;                   
                                        /* reference constant */
};
completionProc
Contains a pointer to your completion function. Your completion function may be called at interrupt time. Therefore, the value of the A5 register is unknown, and your function may not use Memory Manager functions or other functions that move memory.

completionRefCon
Contains a reference constant for use by your completion function.

MyCompletionProc

Your completion function should have the following form:

pascal OSErr MyCompletionProc (OSErr result, short flag,
                                          long refcon);
result
Indicator of success of current operation.

flag
Indicates which part of the operation is complete. The following flags are defined:

codecCompletionSource
The Image Compression Manager is done with the source buffer. The Image Compression Manager sets this flag to 1 when it is done with the processing associated with the source buffer. For compression operations, the source is the uncompressed pixel map you are compressing. For decompression operations, the source is the decompressed data you are decompressing.

codecCompletionDest
The Image Compression Manager is done with the destination buffer. The Image Compression Manager sets this flag to 1 when it is done with the processing associated with the destination buffer.

Note that more than one of these flags may be set to 1.

refcon
Contains a reference constant value for use by your completion function. Your application specifies the value of this reference constant in the callback function structure you pass to the Image Compression Manager.

RESULT CODES

noErr

0

No error


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next